package com.zm.sTUDY07_InputStreamReader;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

public class InputStreamReaderDemo01 {
    public InputStreamReaderDemo01() throws FileNotFoundException {
    }
    InputStreamReader isr=new InputStreamReader(new FileInputStream("D:\\project\\IDEAPROJECT\\JavaIO\\src\\main\\resources\\static\\ReaderAndWriter\\isr.txt"));

    public static void main(String[] args) throws IOException {
        InputStreamReaderDemo01 inputStreamReaderDemo01=new InputStreamReaderDemo01();
        //inputStreamReaderDemo01.oneChar();
        inputStreamReaderDemo01.charList();
    }

    public void oneChar() throws IOException {
        int ch;
        while ((ch=isr.read())!=-1){
            System.out.print((char) ch);
        }
        isr.close();
    }

    public void charList() throws IOException {
        char[] chars=new char[1024];
        int len;
        while ((len=isr.read(chars))!=-1){
            System.out.println(new String(chars,0,len));
        }
        isr.close();
    }


}
